package com.five.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Elasticsearch客户端配置
 */
@Configuration
public class ElasticsearchConfig {

    @Bean
    public RestHighLevelClient restHighLevelClient() {
        // 实际生产环境建议配置集群地址
        return new RestHighLevelClient(
                RestClient.builder(
                        new HttpHost("localhost", 9201, "http")
                )
        );
    }
}